import Swal from 'sweetalert2'

export function showSuccess(title = '成功', message = '操作成功') {
  return Swal.fire({
    icon: 'success',
    title: title,
    text: message,
    confirmButtonText: '确定',
    confirmButtonColor: '#67C23A',
    timer: 2000,
    timerProgressBar: true
  })
}

export function showError(title = '错误', message = '操作失败') {
  return Swal.fire({
    icon: 'error',
    title: title,
    text: message,
    confirmButtonText: '确定',
    confirmButtonColor: '#F56C6C'
  })
}

export function showWarning(title = '警告', message = '') {
  return Swal.fire({
    icon: 'warning',
    title: title,
    text: message,
    confirmButtonText: '确定',
    confirmButtonColor: '#E6A23C'
  })
}

export function showInfo(title = '提示', message = '') {
  return Swal.fire({
    icon: 'info',
    title: title,
    text: message,
    confirmButtonText: '确定',
    confirmButtonColor: '#909399'
  })
}

export function showConfirm(title = '提示', message = '确定要执行此操作吗？', confirmText = '确定', cancelText = '取消') {
  return Swal.fire({
    title: title,
    text: message,
    icon: 'question',
    showCancelButton: true,
    confirmButtonText: confirmText,
    cancelButtonText: cancelText,
    confirmButtonColor: '#409EFF',
    cancelButtonColor: '#909399',
    reverseButtons: true
  })
}

export function showLoginPrompt() {
  return Swal.fire({
    icon: 'warning',
    title: '未登录',
    text: '您还没有登录，请先登录后再进行操作',
    showCancelButton: true,
    confirmButtonText: '去登录',
    cancelButtonText: '取消',
    confirmButtonColor: '#409EFF',
    cancelButtonColor: '#909399'
  })
}

